package com.my.cd.bridge;

/**
 * 抽象遥控板具体实现类：普通遥控板
 */
public class ControlPad extends AbstractControlPad {
    private int ch = 0;//频道
    private boolean ison = false;//是否打开

    public ControlPad(TVControl control) {
        super(control);
    }

    @Override
    public void onoff() {
        if (ison) {
            ison = false;
            control.off();
        } else {
            ison = true;
            control.on();
        }
    }

    @Override
    public void nextChannel() {
        ch++;
        control.setChannel(ch);
    }

    @Override
    public void preChannel() {
        ch--;
        if (ch < 0) {
            ch = 200;
        }
        control.setChannel(ch);
    }

}
